import React from "react";
import Reflux from "reflux";
import {LdhPage, LdhPageControl, LdhPageTable, LdhPageBody} from "@biz/PageCompnents";
import {LdhButton} from "@biz/Components";

import {createAction} from "./Action";
import Store from "./Store";
import buildConfig from "./config";
import Search from "./biz/Search";

import "./style.less";

let Config = {};
const prefix="shop-account-page"
export default class shopPage extends Reflux.Component {
    constructor (props) {
        super(props);
        this.action = createAction();
        Config = buildConfig(this.action);
        this.store = new Store(props, Config, this.action);
    }
    componentDidMount() {
        this.search();
    }

    search(){
        let {so} = this.state;
        this.action.search(so);
    }


    componentWillUnmount () {
        this.action.unmount();
    }

    render () {
        return <LdhPage className={prefix}>
            <Search store={this.state} action={this.action}/>
            <LdhPageBody>

                <LdhPageControl>
                    <LdhButton type="primary" onClick={this.action.goCreate.bind(this, "")}>新增</LdhButton>
                </LdhPageControl>

                <LdhPageTable config={Config} store={this.state}></LdhPageTable>

            </LdhPageBody>
        </LdhPage>

    }


}
